package com.zhuojy.equity.mall.admin.web.controller.car;

import com.zhuojy.equity.mall.admin.common.entity.po.car.TCarUsePO;
import com.zhuojy.equity.mall.admin.common.pojo.ResultEntity;
import com.zhuojy.equity.mall.admin.service.car.TCarUseService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author xrz
 * @version 1.0
 * @description:TODO
 * @date 2024/3/28 15:25
 */
@RestController
@RequiredArgsConstructor
@CrossOrigin
@RequestMapping("caruse")
public class TCarUseController {
    @Autowired
    private TCarUseService tCarUseService;

    /**
     * 查询所有用车信息
     * @param tCarUsePO
     * @param pageSize
     * @param pageNum
     * @return
     */
    @RequestMapping("getCarUse")
    private ResultEntity getCarUse(@RequestBody TCarUsePO tCarUsePO, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum")Integer pageNum){
        return tCarUseService.getCarUser(tCarUsePO,pageSize,pageNum);
    }

    /**
     * 添加用车信息
     * @param tCarUsePO
     * @return
     */
    @RequestMapping("addCarUse")
    private ResultEntity addCarUse(@RequestBody TCarUsePO tCarUsePO){
        return tCarUseService.addCarUse(tCarUsePO);
    }

    /**
     * 修该用车信息
     * @param tCarUsePO
     * @return
     */
    @RequestMapping("updateCarUseState")
    private ResultEntity updateCarUseState(@RequestBody TCarUsePO tCarUsePO){

        return tCarUseService.updateCarUserState(tCarUsePO);
    }

    /**
     * 根据id查询用车信息
     * @param id
     * @return
     */
    @RequestMapping("findTCarUseCenterById")
    private ResultEntity findTCarUseCenterById(@RequestParam("id") Integer id){

    return tCarUseService.findTCarUseCenterById(id);
    }
}
